{
    class RoleBarMediator {
        constructor(skin) {
            this._skin = skin;
            this.config = {
                MAX_WIDTH: 212,
                MIN_WIDTH: 10

            }
        }

        setData(data) {
            this._data = data;
            this._skin.dom_quality.index = data.quality;
            this._skin.dom_title.text = data.title;
            this._skin.dom_name.text = data.name;

            let _grade = Math.floor(data.grade / 5);
     
            this._skin.dom_grade.index = _grade;
            this._skin.dom_gradenum.text = data.grade;
            this._skin.dom_cupnum.text  = data.cup_num;

           // 英雄段位
            let localHeroGrade = Sail.store.getHeroGrade(data.grade);

            let grade_mole = data.cup_num - localHeroGrade.cup_num;  //分子
                grade_mole > 0 ? grade_mole : 0 ;
            let grade_deno = localHeroGrade.next_cup_num;          //分母
            let grade_progress = grade_mole / grade_deno;

            let grade_per = Math.floor( grade_progress * 100 );
            let grade_w = grade_per / 100 * this.config.MAX_WIDTH;

            grade_w = grade_w < this.config.MIN_WIDTH ? this.config.MIN_WIDTH : grade_w; 
            this._skin.dom_progress.width = grade_w;
        }

    }

    Sail.class(RoleBarMediator, 'Com.Role.RoleBarMediator')
}